<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">
        <div><?php include "../public_flow/flow_show_info.php";?></div>
        <div class="tongbox tongbox5">
            <div class="tuo"><div class="tit">项目名称</div><div class="con" id="tong_enginname"></div></div>
            <div class="tuo"><div class="tit">预算编号</div><div class="con" id="tong_number"></div></div>
            <div class="tuo"><div class="tit">预算总金额(元)</div><div class="con" id="tong_money"></div></div>
            <div class="tuo"><div class="tit">编制日期</div><div class="con" id="tong_biandt"></div></div>
            <div class="tuo"><div class="tit">编制人</div><div class="con" id="tong_bianer"></div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">项目信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">项目名称</td><td class="tv colorlan" id="enginid_name" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>

        <div class="table-box tablenes">
            <div class="title">预算信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">预算编号</td><td class="tv" id="number"></td><td class="tt">预算主题</td><td class="tv" id="title"></td></tr>
                <tr><td class="tt">预算总金额(元)</td><td class="tv" id="money" colspan="3"></td></tr>
                <tr><td class="tt">其中材料费预算(元)</td><td class="tv" id="caifee"></td><td class="tt">材料费占比(%)</td><td class="tv" id="cairate"></td></tr>
                <tr><td class="tt">其中人工费预算(元)</td><td class="tv" id="renfee"></td><td class="tt">人工费占比(%)</td><td class="tv" id="renrate"></td></tr>
                <tr><td class="tt">其中机械设备费预算(元)</td><td class="tv" id="jifee"></td><td class="tt">机械设备费占比(%)</td><td class="tv" id="jirate"></td></tr>
                <tr><td class="tt">其中专业分包费预算(元)</td><td class="tv" id="fenfee"></td><td class="tt">专业分包费占比(%)</td><td class="tv" id="fenrate"></td></tr>
                <tr><td class="tt">其中其他费预算(元)</td><td class="tv" id="qifee"></td><td class="tt">其他费占比(%)</td><td class="tv" id="qirate"></td></tr>
                <tr><td class="tt">编制人</td><td class="tv" id="bianer"></td><td class="tt">编制日期</td><td class="tv" id="biandt"></td></tr>
                <tr><td class="tt">备注</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>


        <div><?php include "../public/upinfo_show.php";?></div>

        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>


        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo_bian">预算变更</script>
            <div class="tableShow">
                <table id="datalist_bian" lay-filter="datalist_bian"></table>
            </div>
        </div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo_list">预算明细</script>
            <div class="tableShow">
                <table id="datalist_list" lay-filter="datalist_list"></table>
            </div>
        </div>


        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>


    <div class="showrrboxtext">
        <div class="table-box tablenes">
            <div class="title">总预算</div>
            <div class="tuo"><div class="tit">预算额(元)</div><div class="con" id="right_budget_money">0</div></div>
            <div class="tuo"><div class="tit">合同额(元)</div><div class="con" id="right_caimoney">0</div></div>
            <div class="tuo"><div class="tit">合同/预算占比(%)</div><div class="con" id="right_budget_rate_all">0</div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">材料预算</div>
            <div class="tuo"><div class="tit">预算额(元)</div><div class="con" id="right_budget_caifee">0</div></div>
            <div class="tuo"><div class="tit">合同额(元)</div><div class="con" id="right_cai_hefee">0</div></div>
            <div class="tuo"><div class="tit">合同/预算占比(%)</div><div class="con" id="right_budget_rate_cai">0</div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">人工预算</div>
            <div class="tuo"><div class="tit">预算额(元)</div><div class="con" id="right_budget_renfee">0</div></div>
            <div class="tuo"><div class="tit">合同额(元)</div><div class="con" id="right_ren_hefee">0</div></div>
            <div class="tuo"><div class="tit">合同/预算占比(%)</div><div class="con" id="right_budget_rate_ren">0</div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">机械设备预算</div>
            <div class="tuo"><div class="tit">预算额(元)</div><div class="con" id="right_budget_jifee">0</div></div>
            <div class="tuo"><div class="tit">合同额(元)</div><div class="con" id="right_ji_hefee">0</div></div>
            <div class="tuo"><div class="tit">合同/预算占比(%)</div><div class="con" id="right_budget_rate_ji">0</div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">专业分包预算</div>
            <div class="tuo"><div class="tit">预算额(元)</div><div class="con" id="right_budget_fenfee">0</div></div>
            <div class="tuo"><div class="tit">合同额(元)</div><div class="con" id="right_fen_hefee">0</div></div>
            <div class="tuo"><div class="tit">合同/预算占比(%)</div><div class="con" id="right_budget_rate_fen">0</div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">其他费预算</div>
            <div class="tuo"><div class="tit">预算额(元)</div><div class="con" id="right_budget_qifee">0</div></div>
            <div class="tuo"><div class="tit">合同额(元)</div><div class="con" id="right_qi_hefee">0</div></div>
            <div class="tuo"><div class="tit">合同/预算占比(%)</div><div class="con" id="right_budget_rate_qi">0</div></div>
        </div>
    </div>
    <div><?php include '../public/shrrbox.php'?></div>
</div>
<script>
    var param_id = getQueryVariable('id') || 0;

    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_engin_budget_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;
                $("#flowdingname").text(data.title);

                if(engininfo){
                    $("#tong_enginname").text(engininfo.name);
                }
                $("#tong_number").text(data.number);
                $("#tong_money").text(parseFormatNum(data.money));
                $("#tong_biandt").text(data.biandt);
                $("#tong_bianer").text(data.bianer);


                if(engininfo){
                    $("#right_budget_money").text(parseFormatNum(engininfo.budget_money));
                    $("#right_caimoney").text(parseFormatNum(engininfo.caimoney)).addClass('colorlan').click(function () {
                        openNavPage('查看支出合同信息','contract_cai/index.php?status=1&enginid='+engininfo.id);
                    });
                    $("#right_budget_rate_all").text(engininfo.budget_rate_all);


                    $("#right_budget_caifee").text(parseFormatNum(engininfo.budget_caifee));
                    $("#right_cai_hefee").text(parseFormatNum(engininfo.cai_hefee)).addClass('colorlan').click(function () {
                        openNavPage('查看支出合同信息','contract_cai/index.php?status=1&caitype=cai&enginid='+engininfo.id);
                    });
                    $("#right_budget_rate_cai").text(engininfo.budget_rate_cai);

                    $("#right_budget_renfee").text(parseFormatNum(engininfo.budget_renfee));
                    $("#right_ren_hefee").text(parseFormatNum(engininfo.ren_hefee)).addClass('colorlan').click(function () {
                        openNavPage('查看支出合同信息','contract_cai/index.php?status=1&caitype=ren&enginid='+engininfo.id);
                    });
                    $("#right_budget_rate_ren").text(engininfo.budget_rate_ren);

                    $("#right_budget_jifee").text(parseFormatNum(engininfo.budget_jifee));
                    $("#right_ji_hefee").text(parseFormatNum(engininfo.ji_hefee)).addClass('colorlan').click(function () {
                        openNavPage('查看支出合同信息','contract_cai/index.php?status=1&caitype=ji&enginid='+engininfo.id);
                    });
                    $("#right_budget_rate_ji").text(engininfo.budget_rate_ji);

                    $("#right_budget_fenfee").text(parseFormatNum(engininfo.budget_fenfee));
                    $("#right_fen_hefee").text(parseFormatNum(engininfo.fen_hefee)).addClass('colorlan').click(function () {
                        openNavPage('查看支出合同信息','contract_cai/index.php?status=1&caitype=fen&enginid='+engininfo.id);
                    });
                    $("#right_budget_rate_fen").text(engininfo.budget_rate_fen);

                    $("#right_budget_qifee").text(parseFormatNum(engininfo.budget_qifee));
                    $("#right_qi_hefee").text(parseFormatNum(engininfo.qi_hefee)).addClass('colorlan').click(function () {
                        openNavPage('查看支出合同信息','contract_cai/index.php?status=1&caitype=qi&enginid='+engininfo.id);
                    });
                    $("#right_budget_rate_qi").text(engininfo.budget_rate_qi);

                }





                if(engininfo){
                    $("#enginid_name").text(engininfo.name).click(function () {
                        openPage('../engin/show.php?id='+engininfo.id);
                    });
                }


                $("#number").text(data.number);
                $("#title").text(data.title);
                $("#money").text(showChineseNumber(data.money));
                $("#caifee").text(data.caifee);
                $("#cairate").text(data.cairate);
                $("#renfee").text(data.renfee);
                $("#renrate").text(data.renrate);
                $("#jifee").text(data.jifee);
                $("#jirate").text(data.jirate);
                $("#fenfee").text(data.fenfee);
                $("#fenrate").text(data.fenrate);
                $("#qifee").text(data.qifee);
                $("#qirate").text(data.qirate);
                $("#bianer").text(data.bianer);
                $("#biandt").text(data.biandt);
                $("#explain").text(data.explain);




                var mytableListbian = table.render({
                    elem: "#datalist_bian",data:res.data.bian, toolbar: '#toolbarDemo_bian', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',fixed:'left'}
                        ,{field:'',title:'流程状态',templet: function(d){
                                if(d.billid > 0){
                                    if(d.status == 0){
                                        return '<span class="list_billid colorlan" onclick="openPage(\'../engin_budbian/show.php?id='+d.id+'\');">流程(审批中)</span>'
                                    }else if(d.status == 1){
                                        return '<span class="list_billid colorlan" onclick="openPage(\'../engin_budbian/show.php?id='+d.id+'\');">流程(审批通过)</span>'
                                    }else{
                                        return '';
                                    }
                                }else{
                                    return '<td>手动</td>';
                                }
                            }}
                        ,{field: 'title', title: '本次变更主题'}
                        ,{field:'number',title:'变更单号',templet: function(d){
                            return '<span class="colorlan" onclick="openPage(\'../engin_budbian/show.php?id='+d.id+'\');">'+d.number+'</span>'
                        }}
                        ,{field: 'type_name', title: '本次变更类型'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });


                var mytableList = table.render({
                    elem: "#datalist_list",data:res.data.list, toolbar: '#toolbarDemo_list', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',fixed:'left'}
                        ,{field: 'budtype_name', title: '预算分类'}
                        ,{field: 'name', title: '名称及规格'}
                        ,{field: 'unit', title: '单位'}
                        ,{field: 'num', title: '预算数量'}
                        ,{field: 'price', title: '预算单价(元)',align:'right',templet: function(d){return parseFormatNum(d.price);}}
                        ,{field: 'money', title: '预算金额(元)',align:'right',templet: function(d){return parseFormatNum(d.money);}}
                        ,{field: 'explain', title: '预算说明'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });



                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('engin_budget', param_id);
    });



</script>
</body>
</html>




